import requestInstance from '../index'
import type { IResData } from '../login/type'
const getUserList = (params) => {
  return requestInstance.post<IResData>({
    url: '/users/list',
    data: params
  })
}
const getDeptList = (params) => {
  return requestInstance.post<IResData>({
    url: '/department/list',
    data: params
  })
}
const getRoleList = (params) => {
  return requestInstance.post<IResData>({
    url: '/role/list',
    data: params
  })
}
const addUser = (params) => {
  return requestInstance.post<IResData>({
    url: '/users',
    data: params
  })
}
const updateUser = (id, params) => {
  return requestInstance.patch<IResData>({
    url: `/users/${id}`,
    data: params
  })
}

const deleteUser = (id) => {
  return requestInstance.delete<IResData>({
    url: `/users/${id}`
  })
}
export { getUserList, getDeptList, getRoleList, addUser, updateUser, deleteUser }
